package cloud.xiangyixiang.www.spring.boot.java.basics.utils;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

/**
 * <p>
 * Socket 服务端接收文件
 * </p>
 *
 * @author weixin
 * @date 2023/9/4 17:39
 */
public class IoSocketServerUtil {

    public static void main(String[] args) throws IOException {
        try (ServerSocket server = new ServerSocket(9999)) {
            while (true) {
                Socket socket = server.accept();
                MyDownloadRunnable download = new MyDownloadRunnable(socket);
                Thread thread = new Thread(download);
                thread.start();
            }
        }
    }

}
